import { createContext, useState } from "react";
import SonCom from "./SonCom";
import SonCom2 from "./SonCom2";

 export const Context:any= createContext(null);
export default function UseContextDemo(){

    const [title,setTitle]=useState("hello");
    return (
        <div>

            {title}

            <button onClick={()=>setTitle("你好")}>修改</button>

          <Context.Provider value={{title,setTitle}}>
                <SonCom></SonCom>
                 <SonCom2></SonCom2>
             </Context.Provider>
        </div>
    )
}